package net.gldwork.facadegen.util;

import net.gldwork.srcpdr.SourceProducer;
import net.gldwork.srcpdr.SourceProducerFactory;

public class SPUtil {
	public static String FACADE_CLASSNAME = "FacadeService";
	public static String FACADE_PKG = "net.gldwork.test";
	public static String FACADE_SUPERCLASS = "net.gldwork.test.BaseService";

	public static SourceProducer initSourceProducer() {
		SourceProducer sp = SourceProducerFactory.create();

		sp.setName(FACADE_CLASSNAME);

		sp.setPackage(FACADE_PKG);

		if (FACADE_SUPERCLASS != null && FACADE_SUPERCLASS.length() > 0) {
			String[] arrSuper = FacadeGenUtil.splitQName(FACADE_SUPERCLASS);

			sp.addImport(FACADE_SUPERCLASS);
			sp.setExtends(arrSuper[1]);

		}
		sp.addImport("javax.ejb.Singleton");
		sp.addImport("javax.ejb.Startup");
		sp.addImport("javax.ejb.EJB");
		sp.addAnnotation("@Singleton");
		sp.addAnnotation("@Startup");
		return sp;

	}

}
